package com.kikcn.activemq;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Component;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.TextMessage;

@Component
public class Consumer {

    @JmsListener(destination = "sample.queue",selector = "name is null")
    public void receiveQueue(org.springframework.messaging.Message msg) {


        System.out.println("=======aaaaa=====");
        System.out.println("=======aaaaa=====");

        System.out.println((MyMessage) msg.getPayload());


    }

    @JmsListener(destination = "sample.queue", selector = "name='b'")
    public void receiveQueueB(MyMessage msg) {
        System.out.println("=======bbbbb=====");
        System.out.println("=======bbbbb=====");
        System.out.println("bbbbbbb");
        System.out.println(msg);

    }
}